/*

Author   : chaos

FileName : fun_str.cpp

Date     : 09/08/17 11:40:54

*/
#include <iostream>
using namespace std;

int str_upper(char *);
int main(void)
{
    char str[] = "Hello";

    cout << "Before replacing :" << str << endl;

    cout << str_upper(str) << "chars are replaced." << endl;

    cout << "After repacing:" << str << endl;

    return 0;
}


int str_upper(char *ptr_to_str){
    int replace_num = 0;

    while (*ptr_to_str != '\0'){

        if((*ptr_to_str > 'a') && (*ptr_to_str <= 'z')){
             *ptr_to_str -= 32;
            replace_num ++;
        }
        ptr_to_str++;
    }
    return replace_num;
}
